package com.kancy.streamplus.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

import java.util.Map;
import java.util.TreeMap;

/**
 * StreamPlusProperties
 *
 * @author kancy
 * @date 2020/3/22 15:05
 */
@ConfigurationProperties(prefix = "streamplus")
public class StreamPlusProperties {

    /**
     * 调度器
     */
    @NestedConfigurationProperty
    private Dispatcher dispatcher = new Dispatcher();

    /**
     * 轮询消息
     */
    private Map<String, PollingMessageProperties> pollingMessage = new TreeMap<>();

    public Map<String, PollingMessageProperties> getPollingMessage() {
        return pollingMessage;
    }

    public void setPollingMessage(Map<String, PollingMessageProperties> pollingMessage) {
        this.pollingMessage = pollingMessage;
    }

    public Dispatcher getDispatcher() {
        return dispatcher;
    }

    public void setDispatcher(Dispatcher dispatcher) {
        this.dispatcher = dispatcher;
    }

    public static class Dispatcher {
        /**
         * 是否启用Dispatcher
         */
        private boolean enabled;

        public boolean isEnabled() {
            return enabled;
        }

        public void setEnabled(boolean enabled) {
            this.enabled = enabled;
        }
    }

}
